//	ID : pallab81
// 	PROG : 10827
// 	LANG : C++
// 	2011-08-29-12.53.09 Monday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define VI vector< int >
#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define fo(i,ed) for(int i = 0 ; i < ed ; ++i )
#define foR(i,st,ed) for(int i = st ; i < ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

inline void wait( double seconds ) {
    double endtime = clock()+( seconds* CLOCKS_PER_SEC );
    while( clock() < endtime ) {
        ;
    }
}
int g[ 76*4 ][ 76*4 ];
int vps[ 76*4 ][ 76*4 ];    //vertical prefix sum
int N;

inline void Read() {
    CI(N);
    fo(i,N) {
        fo(j,N) {
            CI(g[i][j]);
        }
    }
}
inline void Adjast() {
    fo(i,N) {
        fo(j,N) {
            g[i][j+N]=g[i][j];
            g[i+N][j]=g[i][j];
            g[i+N][j+N]=g[i][j];
        }
    }
    N=N*2;
}
inline void VerticalPrefixSum() {
    fo(j,N){
        int sum=0;
        fo(i,N){
            sum+=g[i][j];
            vps[i][j]=sum;
        }
    }
}
inline void Print() {
    fo(i,N) {
        fo(j,N) {
            printf("%3d",vps[i][j]);
        }
        printf("\n");
    }
}
inline int Kadane() {
    int mid= N/2;
    int maxSum = (int)-1e7;

    for(int rowa=1; rowa<mid+1; ++rowa){
        for(int rowb=0;rowb<N-rowa; ++rowb){
            for(int i=0;i<mid;++i){
                int currentMaxSum=0;
                for(int col=i;col< (mid+i);++col){
                    //printf("%d %d %d %d\n",rowa+rowb,col, rowb, col);
                    currentMaxSum+= vps[rowa+rowb][col] - vps[rowb][col];
                    if( currentMaxSum > maxSum ){
                        maxSum = currentMaxSum;
                    }
                    if(currentMaxSum < 0 ){
                        currentMaxSum=0;
                    }
                }
            }
        }
    }
return maxSum;
}

inline void Proc() {
    Adjast();
    VerticalPrefixSum();
    //Print();
    int var = Kadane();
    printf("%d\n",var);
}

int main() {
//#ifndef ONLINE_JUDGE
//    freopen("in.txt","rt",stdin);
//#endif

    int cases=1;
    for( CI(cases) ; cases ; --cases ) {
        Read();
        Proc();
    }

    return 0;
}
